<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Gym Rat | Search for Routines</title>
</head>
<body>
<jsp:include page="/includes/nav.jsp" />
<h1>Search for New Routines</h1>
<ul>
	<li>stuff</li>
</ul>
<form action="${pageContext.request.contextPath}/routine/search"
	method="get">
<table>
	<tr>
		<td>Search by description:</td>
		<td><input type="text" name="description" value="${description }"></td>
	</tr>
	<tr>
		<td><input type="button" value="Search" onClick="submit()"></td>
	</tr>
</table>
</form>
<hr>
<table width="100%">
	<tr class="tableHeader">
		<td>Name</td>
		<td>Description</td>
		<td>Creator</td>
		<td>Primary</td>
		<td>Secondary</td>
		<td>Votes</td>
		<td>Current Users</td>
	</tr>
	<c:forEach var="routine" items="${results }">
		<tr>
			<td><a href="<c:url value='/routine/view?id=${routine.id}' />">${routine.name}</a></td>
			<td>${routine.description }</td>
			<td>${routine.author } (${routine.creatorId })</td>
			<td>${routine.primary }</td>
			<td>${routine.secondary}</td>
			<td><b><span style="color:green">+${routine.votesUp}</span> / <span style="color:red">-${routine.votesDown}</span></b></td>
			<td>${routine.users }</td>
		</tr>
	</c:forEach>
</table>
</body>
</html>